import request from '@/utils/request'
import { exportMethod } from '@/utils/utils'
import {
  downloadCardMethod,
  downloadFile,
  downloadMethod,
  updateMethod,
  updateWord,
} from '@/utils/utilsmoban'
import download from '@/utils/downFiles'

export default {
  //获取列表
  getTotalList(data) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/getTotalList',
      method: 'post',
      data,
    })
  },
  getBonus(data) {
    return request({
      url: '/checc-api/kgptKjslTawardTechBonus/getBonus',
      method: 'post',
      data,
    })
  },
  //奖金汇总获取列表
  getbonusTotalList(data) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/getbonusTotalList',
      method: 'post',
      data,
    })
  },
  //奖金分配清单获取列表
  getbonusList(data) {
    return request({
      url: '/checc-api/kgptKjslTawardTechBonus/getBonus',
      method: 'post',
      data,
    })
  },
  //奖金分配清单获取列表
  getbonusShareList(data) {
    return request({
      url: '/checc-api/kgptKjslTawardTechBonus/getBonus',
      method: 'post',
      data,
    })
  },
  //奖金分配
  postBonusAdd(data) {
    return request({
      url: '/checc-api/kgptKjslTawardTechBonus/add',
      method: 'post',
      data,
    })
  },
  //获取项目
  getProjectList() {
    return request({
      url: '/checc-api/kgptKjslTchieveSttrans/projectname',
      method: 'post',
    })
  },
  //公示获取列表
  getDateList(data) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/getDateList',
      method: 'post',
      data,
    })
  },
  //删除
  deleteList(params) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/delete',
      method: 'post',
      params,
    })
  },
  // 新增
  insert(data: any) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/add',
      method: 'post',
      data,
    })
  },
  // 修改
  edit(data: any) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/updatedate',
      method: 'post',
      data,
    })
  },
  // 添加奖金汇总备注
  updatedateremark1(data: any) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/updatedateremark1',
      method: 'post',
      data,
    })
  },
  //查询
  searchParams(data: any) {
    return request({
      url: '/checc-api/checc-api/dictItem/codelist',
      method: 'post',
      data,
    })
  },


  // 详情
  detailData(data: any) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/detaildate',
      method: 'post',
      data,
    })
  },

  // 提交
  submit(data: any) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/submit',
      method: 'post',
      data,
    })
  },

  // 撤销
  rollback(data: any) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/rollback',
      method: 'post',
      data,
    })
  },

  // 审核不通过
  auditNotPass(data: any) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/auditNotPass',
      method: 'post',
      data,
    })
  },

  // 审核通过
  auditPass(data: any) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/auditPass',
      method: 'post',
      data,
    })
  },

  // 导出
  export(data: any, fileName) {
    const params = {
      method: 'post',
      url: '/checc-api/kgptKjslTawardTechresult/export',
      data: data,
      fileName: fileName,
    }
    return exportMethod(params)
  },
  // 导出奖金分配
  exportShares(data: any, fileName) {
    const params = {
      method: 'post',
      url: '/checc-api/kgptKjslTawardTechBonus/export',
      data: data,
      fileName: fileName,
    }
    return exportMethod(params)
  },
  // 导出经费明细
  exportBonus(data: any, fileName) {
    const params = {
      method: 'post',
      url: '/checc-api/kgptKjslTawardTechBonus/export',
      data: data,
      fileName: fileName,
    }
    return exportMethod(params)
  },
  // 导出奖金汇总
  exportSummary(data: any, fileName) {
    const params = {
      method: 'post',
      url: '/checc-api/kgptKjslTawardTechresult/exportBonus',
      data: data,
      fileName: fileName,
    }
    return exportMethod(params)
  },
  
  // 下载模版
  updatemb(data: any, fileName) {
    // return download({
    return updateWord({
      fileName: fileName,
      url: '/checc-api/kgptKjslTawardTechresult/template',
      params: {
        data,
      },
    })
    // const params = {
    //   method:'post',
    //   url: '/checc-api/kgptKjslTawardTechresult/template',
    //   data:data,
    //   fileName:fileName
    // }
    // return downloadCardMethod(params)
  },

  // 公示导出
  exportgongs(data: any, fileName) {
    const params = {
      method: 'post',
      url: '/checc-api/kgptKjslTawardTechresult/exportgongs',
      data: data,
      fileName: fileName,
    }
    return exportMethod(params)
  },

  //关联对象
  gldxList(data: any) {
    return request({
      url: '/checc-api/kgptKjslTawardTechresult/getDataList',
      method: 'post',
      data,
    })
  },

  //关联对象 项目详情
  projectDetails(data: any) {
    return request({
      url: `/checc-api/kgptKjslTawardTechresult/getzijiList`,
      method: 'post',
      data,
    })
  },

  //科技奖项
  kjjxList(id: any) {
    return request({
      url: '/checc-api/kjsl/tresult/techaward/getDetailById?id=' + id,
      method: 'post',
    })
  },

  //发明专利
  fmzlList(data: any) {
    return request({
      url: '/checc-api/kjsl/tresult/patent/list',
      method: 'post',
      data,
    })
  },

  //学术著作
  xszzList(id: any) {
    return request({
      url: `/checc-api/kjsl/tresult/copyrights/getDetailById/${id}`,
      method: 'get',
    })
  },

  //技术标准
  jsbzList(id: any) {
    return request({
      url: '/checc-api/kjsl/tresult/contribute/standard/getDetailById?id=' + id,
      method: 'post',
    })
  },

  //技术工法
  jsgfList(id: any) {
    return request({
      url: '/checc-api/kjsl/tresult/contribute/techmethod/getDetailById?id=' + id,
      method: 'post',
    })
  },

  //学术论著
  xslzList(id: any) {
    return request({
      url: `/checc-api/kjsl/tresult/academicwork/getDetailById/${id}`,
      method: 'get',
    })
  },

  //学术论文
  xslwList(id: any) {
    return request({
      url: `/checc-api/kjsl/tresult/academicpaper/getDetailById/${id}`,
      method: 'get',
    })
  },

  // 流程中心--启动

  startProcess(data: any) {
    return request({
      url: '/process-api/act/run/startProcess',
      method: 'post',
      data,
    })
  },

  // 流程--通过
  allowProcess(data: any) {
    return request({
      url: '/process-api/act/task/completeTaskByVo',
      method: 'post',
      data,
    })
  },

  // 流程--驳回
  refuseProcess(data: any) {
    return request({
      url: '/process-api/act/task/over',
      method: 'post',
      data,
    })
  },
   // 根据年份获取领导审批详情
   getYearData(yaer: any) {
    return request({
      url: `/checc-api/kgptKjslTawardTechBonus/getLeaderApprovalDetailByYear?year=${yaer}`,
      method: 'get',
    })
  },
  //提交领导审批
  leaderApproval(data) {
    return request({
      url: '/checc-api/kgptKjslTawardTechBonus/commitApproval',
      method: 'post',
      data,
    })
  },
  //提交 驳回
  leaderCommit(data) {
    return request({
      url: '/checc-api/kgptKjslTawardTechBonus/approve',
      method: 'post',
      data,
    })
  },
  //领导审批查询
  leaderApprovalt(data: any) {
    return request({
      url: 'checc-api/kgptKjslTawardTechBonus/leaderApproval',
      method: 'post',
      data,
    })
  },
}
